/*------------------------------
 *hfile:      Vge_ccgisTableStruct.h             
 *Created Date:  4/23/2001             
 *Developer:  Stephen.Yao              
 *Studio:	 Zhuq Studio			  
 *------------------------------
 */
#ifndef CCGISTABLESTRUCT__H__INTERFACE
#define CCGISTABLESTRUCT__H__INTERFACE

#include "Vge_ccgisgeoobj.h"

#include "Vge_ccgisDDTableStruct.H"

namespace ccgis{
/*----------------------------------------------------------------*/
/*                   class CcgisLTableRecordInfo                  */
/*----------------------------------------------------------------*/
class AFX_EXT_CLASS CcgisLTableRecordInfo
{
public:
	/*Constructor*/
	CcgisLTableRecordInfo();
    
	/*Changer*/
	void  setTableName(char newName[MAX_NAME]);
	void  setTableFlag(int newFlag);
	void setIndexFlag( BOOL bNewIndexed );
	
	CcgisLTableRecordInfo& operator=(CcgisLTableRecordInfo &other);
	BOOL operator==(CcgisLTableRecordInfo &other);
	BOOL operator!=(CcgisLTableRecordInfo &other);

	char TableName[MAX_NAME];
	int TableFlag;
	BOOL bIndexed;
};

/*----------------------------------------------------------------*/
/*                    class CcgisLocalTableInfo                   */
/*----------------------------------------------------------------*/
class AFX_EXT_CLASS CcgisLocalTableInfo
{
public:
	/*Constructor*/
	CcgisLocalTableInfo();
	
	/*Accessor*/
	BOOL getTableRecord(int i,CcgisLTableRecordInfo &tRec);
	BOOL getTypeRecord(int nType,CcgisLTableRecordInfo &tRec);
	BOOL getTypeRecord(int nType,CcgisLTableRecordInfo *&tRec);

	/*Changer*/
	BOOL setTableRecord(CcgisLTableRecordInfo rec,int i);

	BOOL removeRecord(int i);
	BOOL appendRecord(CcgisLTableRecordInfo rec);
	
	CcgisLocalTableInfo& operator=(CcgisLocalTableInfo &other);
	BOOL operator==(CcgisLocalTableInfo &other);
	BOOL operator!=(CcgisLocalTableInfo &other);

	CcgisLTableRecordInfo LTables[10];
	int TableNum;
};

/*----------------------------------------------------------------*/
/*                    class CcgisGTableRecordInfo                 */
/*----------------------------------------------------------------*/
class AFX_EXT_CLASS CcgisGTableRecordInfo
{
public:
	/*Constructor*/
	CcgisGTableRecordInfo();
	
	/*Changer*/
	void  setLTable(CcgisLocalTableInfo newTable);
	void  setLTableName(char newName[MAX_NAME]);

	BOOL  getWrapBound(double inMinx,double inMiny,double inMaxx,double inMaxy,
		               double &ouMinx,double &ouMiny,double &ouMaxx,double &ouMaxy);
	CcgisGTableRecordInfo& operator=(CcgisGTableRecordInfo &other);
	BOOL operator==(CcgisGTableRecordInfo &other);
	BOOL operator!=(CcgisGTableRecordInfo &other);

	char LTableName[MAX_NAME];
	double minx,miny,maxx,maxy;
	CcgisLocalTableInfo LTable;
};

/*----------------------------------------------------------------*/
/*                      class CcgisGlobalTableInfo                */
/*----------------------------------------------------------------*/
class AFX_EXT_CLASS CcgisGlobalTableInfo
{
public:
	/*Constructor*/
	CcgisGlobalTableInfo();
	CcgisGlobalTableInfo(CcgisGlobalTableInfo &gtable);

	/*Accessor*/
	BOOL getTableRecord(int i,CcgisGTableRecordInfo &tRec);
	BOOL getTableRecord(char lTabName[MAX_NAME],CcgisGTableRecordInfo &tRec);

	void  SortTable();

	/*Changer*/
	BOOL setTableRecord(CcgisGTableRecordInfo rec,int i);
	void clearInfo();

	BOOL removeRecord(int i);
	BOOL appendRecord(CcgisGTableRecordInfo rec);

	CcgisGlobalTableInfo& operator=(CcgisGlobalTableInfo &other);
	BOOL operator==(CcgisGlobalTableInfo &other);
	BOOL operator!=(CcgisGlobalTableInfo &other);

	CcgisGTableRecordInfo GTables[MAX_TABLES];
	char TableName[MAX_NAME];
	int TableNum;
};
/*----------------------------------------------------------------*/
/*                      class CcgisAttriRecordInfo                */
/*----------------------------------------------------------------*/
class AFX_EXT_CLASS CcgisAttriRecordInfo
{
public:
	/*Constructor*/
	CcgisAttriRecordInfo();
	CcgisAttriRecordInfo(char code[MAX_NAME],char tname[MAX_NAME]);
	
	/*Changer*/
	void  setGeoCode(char newCode[MAX_NAME]);
	void  setTableName(char newName[MAX_NAME]);
	void  setGeoType(int newType);
	
	CcgisAttriRecordInfo& operator=(CcgisAttriRecordInfo &other);
	BOOL operator==(CcgisAttriRecordInfo &other);
	BOOL operator!=(CcgisAttriRecordInfo &other);

	char GeoCode[MAX_NAME];
	char TableName[MAX_NAME];
	int  GeoType;
};
/*----------------------------------------------------------------*/
/*                      class CcgisAttriManagerInfo                */
/*----------------------------------------------------------------*/
class AFX_EXT_CLASS CcgisAttriManagerInfo
{
public:
	/*Constructor*/
	CcgisAttriManagerInfo();
	CcgisAttriManagerInfo(CcgisAttriManagerInfo &aManager);

	/*Accessor*/
	BOOL getTableRecord(int i,CcgisAttriRecordInfo &tRec);
	BOOL getTableRecord(char code[MAX_NAME],CcgisAttriRecordInfo &tRec);
	BOOL getTableRecord(char code[MAX_NAME],CcgisAttriRecordInfo *&tRec);
	
	/*Changer*/
	BOOL setTableRecord(CcgisAttriRecordInfo rec,int i);
	BOOL setTableName(char newName[MAX_NAME]);
	void clearInfo();

	BOOL removeRecord(int i);
	BOOL appendRecord(CcgisAttriRecordInfo rec);

	CcgisAttriManagerInfo& operator=(CcgisAttriManagerInfo &other);
	BOOL operator==(CcgisAttriManagerInfo &other);
	BOOL operator!=(CcgisAttriManagerInfo &other);

	CcgisAttriRecordInfo AttriTables[1000];
	char TableName[MAX_NAME];
	long TableNum;
};
/*----------------------------------------------------------------*/
/*                      class CcgisGlobalManagerInfo              */
/*----------------------------------------------------------------*/
class AFX_EXT_CLASS CcgisGlobalManagerInfo
{
public:
	/*Constructor*/
	CcgisGlobalManagerInfo();
	CcgisGlobalManagerInfo(CcgisGlobalTableInfo gtInfo,
						   CcgisAttriManagerInfo amInfo,
						   CcgisDemManagerInfo demInfo,
						   CcgisDomManagerInfo domInfo);

	/*Accessor*/
	const char* getGlobalRegionsTableName();
	const char* getGlobalAttriManagerName();
	const char* getGlobalDemManagerName();
	const char* getGlobalDomManagerName();

	CcgisGlobalTableInfo*   getGlobalRegionTableInfo();
	CcgisAttriManagerInfo*  getAttriManagerTableInfo();
	CcgisDemManagerInfo*    getDemManagerTableInfo();
	CcgisDomManagerInfo*    getDomManagerTableInfo();

	/*Changer*/
	void  clearGlobalInfo(int iType);

	void  setGlobalRegionTableInfo(CcgisGlobalTableInfo newTableInfo);
	void  setAttriManagerTableInfo(CcgisAttriManagerInfo newTableInfo);
	void  setDemManagerTableInfo(CcgisDemManagerInfo newTableInfo);
	void  setDomManagerTableInfo(CcgisDomManagerInfo newTableInfo);

	CcgisGlobalManagerInfo& operator=(CcgisGlobalManagerInfo &other);

protected:
	char GlobalRegionsTableName[MAX_NAME];
	CcgisGlobalTableInfo globalRTableInfo;
	char GlobalAttriManagerName[MAX_NAME];
	CcgisAttriManagerInfo attriManagerInfo;
	char GlobalDemManagerName[MAX_NAME];
	CcgisDemManagerInfo demManagerInfo;
	char GlobalDomManagerName[MAX_NAME];
	CcgisDomManagerInfo domManagerInfo;
};

}
#endif